﻿@model LetLord.Models.Tenant
<div class="row-fluid">
    <h4>References</h4>
    <hr />
</div>
<div class="row-fluid">
    @if (Model.ReferencePhotos.Count == 0)
    {
        <h3>You haven't uploaded any references! <a href="#" class="show-modal" role="button" data-toggle="modal">Upload now?</a></h3>
    }
    else
    {
        foreach (var photo in Model.ReferencePhotos)
        {
        <ul class="thumbnails">
            <li class="span8">
                <a href="#" class="thumbnail">
                    <img src="@Url.Action("GetReference", "Tenants", new { id = photo.ImageId })" alt="@photo.Name" />
                </a>
            </li>
            <li class="span4 btn-group">
                @Ajax.ActionLink("Delete", "DeleteReference",
             new { id = photo.ImageId },
             new AjaxOptions { InsertionMode = InsertionMode.Replace, HttpMethod = "POST", UpdateTargetId = "tenant-reference-photos", OnBegin = "return confirm('Are you sure you wish to delete this reference?');" },
             new { @class = "btn btn-primary" })
                <a href="#" class="btn btn-primary" id="add-another-reference" role="button" data-toggle="modal">Add another</a>
            </li>
        </ul>
        }
        
        <div class="modal hide fade in" id="add-another-reference-modal" data-url="@Url.Action("TenantUploadReference", "Tenants")">
            <div id="add-another-reference-container"></div>
        </div>
    }
    <div class="modal hide fade in" id="add-reference">
        <div id="add-reference-container"></div>
    </div>
</div>

